package com.neuedu.mblog.controller;

import com.neuedu.mblog.service.PostService;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Map;

/**
 * 项目：mblog_java4
 * 创建时间：  2022-01-02   10:51
 * 作者 :jshand
 * 描述 : 前台需要登录才能操作的功能
 */
@WebServlet(urlPatterns = "/front/user")
public class FrontUserController extends BaseController {
    private PostService postService = new PostService();

    /**
     * 发布文章
     * @param request
     * @param response
     */
    public void savePost(HttpServletRequest request , HttpServletResponse response) throws SQLException, IOException {
        boolean success = postService.save(request);

        super.jsonResult(response,success);
    }



    public void saveComment(HttpServletRequest request , HttpServletResponse response) throws SQLException, IOException {
        boolean success = postService.saveComment(request);

        super.jsonResult(response,success);
    }

    public void collect(HttpServletRequest request , HttpServletResponse response) throws SQLException, IOException {
        Map ret = postService.collect(request);

        super.jsonResult(response,ret);
    }






}
